Skip to content

fix: harden issue-format guard review follow-ups - #2963

Merged
stranske merged 3 commits into
mainfrom
fix/issue-format-guard-review-followups
Aug 6, 2026
Merged

fix: harden issue-format guard review follow-ups#2963
stranske merged 3 commits into
mainfrom
fix/issue-format-guard-review-followups

Conversation

@stranske

@stranske stranske commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • make every documented readiness section gate issue processing
  • preserve nested Markdown sections and prevent Implementation Notes matching Tasks
  • restrict label-event runs and clear stale format state safely

Validation

  • python -m pytest tests/scripts/test_issue_format.py tests/scripts/test_validate_template_completeness.py tests/scripts/test_validate_template_sync.py tests/scripts/test_sync_manifest_compiler.py -q (78 passed)
  • YAML parse and source/template parity checks

Summary by CodeRabbit

  • Bug Fixes

    • Improved issue-format validation for nested sections, exact heading matches, recommended sections, and verification evidence.
    • Corrected formatting-status handling so stale markers are removed after invalid edits and restored only after successful revalidation.
    • Refined label-triggered workflow behavior and made label-update failures non-blocking warnings.
  • Documentation

    • Clarified required readiness sections, task and verification evidence, and supported workflow behavior.
  • Tests

    • Added coverage for nested headings, recommended sections, and accepted verification wording.

Copilot AI lite review requested due to automatic review settings August 6, 2026 11:34
@cursor

cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 53 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5b6365d5-a973-47b3-b392-359b73de88cf

📥 Commits

Reviewing files that changed from the base of the PR and between 79dd283 and 0718666.

📒 Files selected for processing (6)
  • .github/scripts/issue_format.py
  • .github/workflows/agents-issue-format-guard.yml
  • docs/ci/WORKFLOWS.md
  • templates/consumer-repo/.github/scripts/issue_format.py
  • templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml
  • tests/scripts/test_issue_format.py
📝 Walkthrough

Walkthrough

The issue format validator now enforces recommended sections, preserves nested headings, and accepts verification-prefixed gates. The guard workflows refine event filtering, stale-label removal, optimizer routing, and formatted-label restoration. Tests and CI documentation reflect these rules.

Changes

Issue format guard

Layer / File(s) Summary
Validator parsing and section extraction
.github/scripts/issue_format.py, templates/consumer-repo/.github/scripts/issue_format.py
Heading parsing now includes levels. Alias matching is exact. Nested subsections remain in their parent section. Verification-prefixed gates are accepted.
Validation enforcement and regression coverage
.github/scripts/issue_format.py, templates/consumer-repo/.github/scripts/issue_format.py, tests/scripts/test_issue_format.py, docs/ci/WORKFLOWS.md
Missing recommended sections now make validation fail. Tests cover valid context, task evidence, nested headings, and Verify gates. Documentation describes the updated requirements.
Guard event routing and label state
.github/workflows/agents-issue-format-guard.yml, templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml
The workflows filter relevant label events, clear stale agents:formatted labels before routing invalid issues, and restore the label only after successful unheld revalidation.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubIssueEvent
  participant IssueFormatValidator
  participant GuardWorkflow
  participant Optimizer
  GitHubIssueEvent->>GuardWorkflow: eligible issue or label event
  GuardWorkflow->>IssueFormatValidator: validate issue format
  IssueFormatValidator-->>GuardWorkflow: conforming or non-conforming result
  GuardWorkflow->>GuardWorkflow: remove stale agents:formatted when required
  GuardWorkflow->>Optimizer: route non-conforming issue
  GuardWorkflow->>GuardWorkflow: restore agents:formatted after successful unheld revalidation
Loading

Possibly related PRs

Suggested labels: verify:compare, acceptance-criteria

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes to harden the issue-format guard and address review follow-ups.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-format-guard-review-followups

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 256cb3aacd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/scripts/issue_format.py Outdated
+ "); replace with a measurable check."
)
report.ok = not report.missing_required and not report.problems
report.ok = not report.missing_required and not report.missing_recommended and not report.problems

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep recommended sections advisory

When an issue contains the documented required Tasks and Acceptance Criteria sections but omits Why, Scope, Non-Goals, or the explicitly optional Implementation Notes, this condition now returns exit code 1. The guard consequently marks a contract-conforming issue non-processable and dispatches the optimizer, even though templates/consumer-repo/docs/AGENT_ISSUE_FORMAT.md still classifies all four as recommended rather than required. Either exclude missing_recommended from ok or update the canonical consumer contract and its advisory wording as part of this behavior change.

AGENTS.md reference: AGENTS.md:L60-L65

Useful? React with 👍 / 👎.

stranske added a commit that referenced this pull request Aug 6, 2026
…hanges

#2962 restored a 22-line rationale docstring to the fleet issue-format
validator; this branch had replaced it with a one-line summary and added a
shebang. Conflict resolved by keeping both: #2963's shebang and logic, and the
docstring.

The docstring's description of the contract needed one correction to stay
truthful against this branch's behaviour. `Report.ok` now requires
`not missing_recommended`, so a missing "recommended" section fails the run and
causes the guard to apply `agents:format` -- while the message still calls it an
advisory. The docstring now records that tension rather than repeating the old
required/recommended split as if it still held.

Both copies remain byte-for-byte in lockstep.
tests/scripts/test_issue_format.py: 13 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@stranske

stranske commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main and resolved the conflict with #2962 — kept this branch's shebang and logic plus the restored rationale docstring. Both copies stay byte-for-byte in lockstep; tests/scripts/test_issue_format.py is 13 passed. Not merging, because one change here needs a decision rather than a rebase.

Report.ok now fails on missing recommended sections

Line 177: report.ok = not report.missing_required and not report.missing_recommended and not report.problems

So a missing "recommended" section makes the run exit non-zero, which makes the guard apply agents:format and route the issue to the optimizer. The message still calls it an advisory, so the output contradicts the exit code.

Concrete effect, on a real issue. Fine-Art-Archive #442 has Why, Scope, Non-Goals, 7 tasks, and 6 acceptance criteria including a named deliberate-break gate. The live guard accepted it on the first try. Under this branch it becomes non-conforming — solely for having no Implementation Notes heading:

main:      "Issue body is agent-processable with advisories."
             _Recommended but absent:_ `Implementation Notes`      exit 0

this PR:   "This issue is **not yet agent-processable**."
             _Recommended but absent:_ `Implementation Notes`      exit 1

That is a well-formed work order being flagged for repair. Implementation Notes is also the newest alias and the one issue authors are least likely to have heard of, so this will fire broadly.

Two coherent options

  1. Keep recommended advisory — drop missing_recommended from ok. Advisories still print, so authors still see the nudge, and the guard keeps flagging only issues the lanes genuinely cannot process.
  2. Promote them to required — move them into REQUIRED, change the message from "Recommended but absent" to "Missing required sections", and update docs/AGENT_ISSUE_FORMAT.md so the contract and the enforcement agree.

Either works; the current state is the one that doesn't, because the wording and the exit code disagree. I'd lean to (1): the guard's value is that it fires rarely and means something, and my own note in the workflow says a guard that nags on issues it shouldn't is one people learn to ignore.

The docstring on this branch now records the tension rather than restating the old required/recommended split as if it still held, so whichever way this goes, please update that paragraph to match.

@stranske-keepalive

stranske-keepalive Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 24032cd
Latest Runs: ⏳ pending — Gate
Required contexts: summary
Required: core tests (3.12): ⏳ pending, core tests (3.13): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 1

Coverage Trend

Metric Value
Current 76.22%
Baseline 85.00%
Delta -8.78%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
scripts/issue_dedup_smoke.py 0.0% 4
scripts/runner_lib/__main__.py 0.0% 3
scripts/validate_template_sync.py 0.0% 81
scripts/langchain/topic_splitter.py 19.1% 57
tools/codex_log_analyzer.py 19.6% 140
scripts/repo_review_round2_runner.py 25.1% 344
scripts/prune_agent_stubs.py 39.7% 26
scripts/repo_review_round1_runner.py 40.7% 133
tools/ensure_workflow_timeout_variables.py 42.1% 74
scripts/sync_label_docs.py 42.9% 64
tools/discover_model_catalog.py 44.8% 55
scripts/repo_review_backlog_scan.py 45.3% 116
scripts/repo_review_body_writer.py 46.5% 86
tools/codex_session_analyzer.py 47.9% 59
scripts/create_verifier_labels.py 48.3% 58

Low Coverage Files (<50.0%)

File Coverage Missing
scripts/issue_dedup_smoke.py 0.0% 4
scripts/runner_lib/__main__.py 0.0% 3
scripts/validate_template_sync.py 0.0% 81
scripts/langchain/topic_splitter.py 19.1% 57
tools/codex_log_analyzer.py 19.6% 140
scripts/repo_review_round2_runner.py 25.1% 344
scripts/prune_agent_stubs.py 39.7% 26
scripts/repo_review_round1_runner.py 40.7% 133
tools/ensure_workflow_timeout_variables.py 42.1% 74
scripts/sync_label_docs.py 42.9% 64
tools/discover_model_catalog.py 44.8% 55
scripts/repo_review_backlog_scan.py 45.3% 116
scripts/repo_review_body_writer.py 46.5% 86
tools/codex_session_analyzer.py 47.9% 59
scripts/create_verifier_labels.py 48.3% 58

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the issue-format validation contract and follow-up routing so only fully “ready” issues (including the documented readiness sections) are treated as agent-processable, while also improving guard behavior around nested Markdown headings and label-driven revalidations.

Changes:

  • Make missing “recommended/readiness” sections non-conforming (gating report.ok) and expand accepted verification wording (e.g., “Verify…”).
  • Update the issue-format-guard workflow to restrict label-event runs to relevant hold/exemption labels and to clear stale agents:formatted state when edits invalidate an issue.
  • Add regression tests covering nested headings, “Implementation Notes” not satisfying “Tasks”, and the expanded gate patterns.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/scripts/test_issue_format.py Adds/updates regression tests for readiness gating, nested headings, and gate matching.
.github/scripts/issue_format.py Hardens section parsing (heading levels), tightens alias matching, expands gate regex, and gates on readiness sections.
templates/consumer-repo/.github/scripts/issue_format.py Mirrors the validator changes for consumer template sync parity.
.github/workflows/agents-issue-format-guard.yml Restricts label-trigger execution, clears stale formatted state on invalid edits, and safely removes agents:formatted during reroute.
templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml Mirrors the workflow changes for consumer template sync parity.
docs/ci/WORKFLOWS.md Updates documentation for the format-guard workflow’s stricter readiness + nested heading behavior.
Suppressed comments (2)

.github/scripts/issue_format.py:139

  • report.ok now treats missing RECOMMENDED sections as non-conforming, which makes Report.as_markdown()'s "agent-processable with advisories" branch unreachable and also causes the user-facing output to still describe these blocking sections as "Recommended but absent". That’s confusing for issue authors and makes the report text inconsistent with the new gating behavior.

Consider updating Report.as_markdown() (and possibly the missing_recommended naming / wording) so the markdown clearly communicates that these sections are required for agent processing under the new rules, and remove the now-dead advisory path.

                + ", ".join(f"`{section}`" for section in self.missing_required)

templates/consumer-repo/.github/scripts/issue_format.py:139

  • report.ok now treats missing RECOMMENDED sections as non-conforming, which makes Report.as_markdown()'s "agent-processable with advisories" branch unreachable and also causes the user-facing output to still describe these blocking sections as "Recommended but absent". That’s confusing for issue authors and makes the report text inconsistent with the new gating behavior.

Consider updating Report.as_markdown() (and possibly the missing_recommended naming / wording) so the markdown clearly communicates that these sections are required for agent processing under the new rules, and remove the now-dead advisory path.

                + ", ".join(f"`{section}`" for section in self.missing_required)

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Runner dispatch state for codex on PR #2963. Do not edit.

@stranske

stranske commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Runner dispatch state for autofix on PR #2963. Do not edit.

@stranske
stranske temporarily deployed to agent-high-privilege August 6, 2026 11:50 — with GitHub Actions Inactive
@github-actions github-actions Bot added autofix Opt-in automated formatting & lint remediation autofix:patch labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Autofix updated these files:

  • .github/scripts/issue_format.py
  • templates/consumer-repo/.github/scripts/issue_format.py
  • tests/scripts/test_issue_format.py

@agents-workflows-bot
agents-workflows-bot Bot temporarily deployed to agent-high-privilege August 6, 2026 11:52 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/agents-issue-format-guard.yml (1)

79-91: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not stop optimizer routing when stale-label cleanup fails.

set -e makes a failed gh issue edit --remove-label "agents:formatted" terminate the job. The invalid issue then does not reach the optimizer route. This can occur during an API error or a concurrent label update.

  • .github/workflows/agents-issue-format-guard.yml#L79-L91: make label removal non-fatal and continue to the routing step.
  • templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml#L79-L91: apply the same failure handling.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/agents-issue-format-guard.yml around lines 79 - 91, The
stale-label cleanup in the routing workflow is currently fatal when gh issue
edit fails. In .github/workflows/agents-issue-format-guard.yml lines 79-91 and
templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml lines
79-91, make the agents:formatted removal failure non-fatal so execution always
continues to the optimizer routing step while preserving successful cleanup and
its message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/issue_format.py:
- Around line 27-39: Make recommended sections advisory consistently: update the
policy text at .github/scripts/issue_format.py:27-39 and
templates/consumer-repo/.github/scripts/issue_format.py:27-39, exclude
missing_recommended from Report.ok at both files’ lines 185-187, and keep both
validators identical. Extend tests/scripts/test_issue_format.py:77-83 to assert
report.ok while retaining the advisory-message check, and update
docs/ci/WORKFLOWS.md:157 to distinguish required from recommended sections.

---

Outside diff comments:
In @.github/workflows/agents-issue-format-guard.yml:
- Around line 79-91: The stale-label cleanup in the routing workflow is
currently fatal when gh issue edit fails. In
.github/workflows/agents-issue-format-guard.yml lines 79-91 and
templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml lines
79-91, make the agents:formatted removal failure non-fatal so execution always
continues to the optimizer routing step while preserving successful cleanup and
its message.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: dc592474-93c4-40fc-a77a-450da5331539

📥 Commits

Reviewing files that changed from the base of the PR and between 79dd283 and 1fd6ed1.

📒 Files selected for processing (6)
  • .github/scripts/issue_format.py
  • .github/workflows/agents-issue-format-guard.yml
  • docs/ci/WORKFLOWS.md
  • templates/consumer-repo/.github/scripts/issue_format.py
  • templates/consumer-repo/.github/workflows/agents-issue-format-guard.yml
  • tests/scripts/test_issue_format.py

Comment thread .github/scripts/issue_format.py Outdated
@stranske
stranske force-pushed the fix/issue-format-guard-review-followups branch from 1fd6ed1 to 0718666 Compare August 6, 2026 12:33
@stranske
stranske temporarily deployed to agent-high-privilege August 6, 2026 12:33 — with GitHub Actions Inactive
@stranske
stranske merged commit da4ba1d into main Aug 6, 2026
53 checks passed
@stranske
stranske deleted the fix/issue-format-guard-review-followups branch August 6, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autofix:escalated autofix:patch autofix Opt-in automated formatting & lint remediation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants